Conversation
|
I can likely pick up some of the linalg ones if you like |
|
I'll keep my progress committed and pushed, feel free to push if you have something. If not I'll just gradually keep adding some whenever I'm waiting for other tests, so also shouldn't be a huge issue. |
130f031 to
7a6adcc
Compare
kshyatt
left a comment
There was a problem hiding this comment.
One comment its it might be nice to put some of these pullbacks into shared files like we did with MAK and TO so that if/when we add Enzyme support, we can do so with a light touch
|
I definitely agree that it would be nicer to put this in a better form, but would you be okay with leaving that for a follow-up PR? What is preventing me from actually pulling this through though is that I now am also altering the primal computation in some places, specifically for constructions involving Without actually having the Enzyme code next to it, it's a bit hard to already come up with the correct abstractions to make sure this works for both engines, and I want to avoid having to do that work twice. Additionally, it would be nice to immediately overload the TensorOperations functions but these haven't been released yet (and additionally I would like to play a similar trick there, but haven't gotten around to that yet) |
Yeah that sounds fine, just separating things into discrete functions is great already |
0dd1456 to
bd3cc11
Compare
6037b99 to
e2dc00e
Compare
|
Small update here:
This last part still really confuses me (I remember it also did with the ChainRules), but I'm just going to assume we figured this out correctly last time and copy that here. |
e2dc00e to
3bf4288
Compare
|
Your PR no longer requires formatting changes. Thank you for your contribution! |
3bf4288 to
fe3b92d
Compare
2331978 to
93c8ff1
Compare
0ad41f2 to
8d02b1d
Compare
8d02b1d to
f6f959c
Compare
|
I think this is ready for a final round of review now, everything seems to be working. @Jutho, thanks for the detailed comments in the previous round, there are definitely a number of things I was missing and would have had a hard time finding myself. |
| end | ||
| mul!(ΔU, U, gaugepart, -1, 1) | ||
| return ΔU, ΔVᴴ | ||
| end |
There was a problem hiding this comment.
I assume we cannot recycle these from MatrixAlgebraKit because it is defined in the test setup and not in the main package. Would it be useful to have these functions in the main package, possibly in a Utility submodule? Also, do the Chainrules test also need/have these functions?
There was a problem hiding this comment.
Absolutely yes, although I think that is probably in line with the idea of reusing the MatrixAlgebraKit TestSuite module here, and not having to redefine these functions to begin with.
I don't think we are really totally there yet, and want to avoid coupling the testsets too tightly since then changes in one will break the other, so I'd say that for now this is fine, but it is definitely something that is on the radar
| @isdefined(TestSetup) || include("../setup.jl") | ||
| using .TestSetup | ||
|
|
||
| mode = Mooncake.ReverseMode | ||
| rng = Random.default_rng() | ||
|
|
||
| spacelist = ( | ||
| (ℂ^2, (ℂ^3)', ℂ^3, ℂ^2, (ℂ^2)'), | ||
| ( | ||
| Vect[FermionParity](0 => 1, 1 => 1), | ||
| Vect[FermionParity](0 => 1, 1 => 2)', | ||
| Vect[FermionParity](0 => 2, 1 => 1)', | ||
| Vect[FermionParity](0 => 2, 1 => 3), | ||
| Vect[FermionParity](0 => 2, 1 => 2), | ||
| ), | ||
| ( | ||
| Vect[SU2Irrep](0 => 2, 1 // 2 => 1), | ||
| Vect[SU2Irrep](0 => 1, 1 => 1), | ||
| Vect[SU2Irrep](1 // 2 => 1, 1 => 1)', | ||
| Vect[SU2Irrep](1 // 2 => 2), | ||
| Vect[SU2Irrep](0 => 1, 1 // 2 => 1, 3 // 2 => 1)', | ||
| ), | ||
| ( | ||
| Vect[FibonacciAnyon](:I => 2, :τ => 1), | ||
| Vect[FibonacciAnyon](:I => 1, :τ => 2)', | ||
| Vect[FibonacciAnyon](:I => 2, :τ => 2)', | ||
| Vect[FibonacciAnyon](:I => 2, :τ => 3), | ||
| Vect[FibonacciAnyon](:I => 2, :τ => 2), | ||
| ), | ||
| ) | ||
| eltypes = (Float64, ComplexF64) |
There was a problem hiding this comment.
This seems to return in each of the testfiles. Would it be useful to have a mooncake_setup.jl to include in each test file?
There was a problem hiding this comment.
Perhaps, but on the other hand it is sometimes useful to be able to comment out/change certain parts, and for now I think the amount of duplication is somewhat manageable
Here I am porting over a bunch of our chainrules to the Mooncake ones.
In particular, I am trying to identify the core computational routines and writing the rules for these, while not blindly taking the same methods.
For example, in ChainRules we overload rules for
*(::Number, ::AbstractTensorMap), in Mooncake we simply define a rule forscale!(::AbstractTensorMap, ::Number).To do:
Requires #360 to be merged first!